go/types.operand.typ (field)

345 uses

	go/types (current package)
		api_predicates.go#L34: 	x := operand{mode: value, typ: V}
		api_predicates.go#L45: 	x := operand{mode: value, typ: V}
		assignments.go#L43: 	if isUntyped(x.typ) {
		assignments.go#L58: 				target = Default(x.typ)
		assignments.go#L62: 				if T == nil && x.typ == Typ[UntypedNil] {
		assignments.go#L67: 				target = Default(x.typ)
		assignments.go#L89: 		if newType != x.typ {
		assignments.go#L90: 			x.typ = newType
		assignments.go#L97: 	if sig, _ := under(x.typ).(*Signature); sig != nil && sig.TypeParams().Len() > 0 {
		assignments.go#L122: 	if x.mode == invalid || !isValid(x.typ) || !isValid(lhs.typ) {
		assignments.go#L137: 	assert(isConstType(x.typ))
		assignments.go#L141: 		lhs.typ = x.typ
		assignments.go#L157: 	if x.mode == invalid || !isValid(x.typ) || !isValid(lhs.typ) {
		assignments.go#L167: 		typ := x.typ
		assignments.go#L222: 	if x.mode == invalid || !isValid(x.typ) {
		assignments.go#L246: 	return x.typ
		assignments.go#L284: 		res = append(res, x.typ)
		builtins.go#L93: 		S := x.typ
		builtins.go#L122: 				if t := coreString(y.typ); t != nil && isString(t) {
		builtins.go#L124: 						sig := makeSig(S, S, y.typ)
		builtins.go#L129: 					x.typ = S
		builtins.go#L142: 		x.typ = S
		builtins.go#L152: 		switch t := arrayPtrDeref(under(x.typ)).(type) {
		builtins.go#L187: 			if !isTypeParam(x.typ) {
		builtins.go#L190: 			if underIs(x.typ, func(u Type) bool {
		builtins.go#L211: 			if isValid(under(x.typ)) {
		builtins.go#L223: 			check.recordBuiltinType(call.Fun, makeSig(Typ[Int], x.typ))
		builtins.go#L227: 		x.typ = Typ[Int]
		builtins.go#L234: 		if !underIs(x.typ, func(u Type) bool {
		builtins.go#L247: 			check.recordBuiltinType(call.Fun, makeSig(nil, x.typ))
		builtins.go#L252: 		if !underIs(x.typ, func(u Type) bool {
		builtins.go#L268: 			check.recordBuiltinType(call.Fun, makeSig(nil, x.typ))
		builtins.go#L277: 		if isUntyped(x.typ) {
		builtins.go#L280: 		if isUntyped(y.typ) {
		builtins.go#L288: 			check.convertUntyped(x, y.typ)
		builtins.go#L291: 			check.convertUntyped(y, x.typ)
		builtins.go#L303: 					if isNumeric(x.typ) && constant.Sign(constant.Imag(x.val)) == 0 {
		builtins.go#L304: 						x.typ = Typ[UntypedFloat]
		builtins.go#L321: 		if !Identical(x.typ, y.typ) {
		builtins.go#L322: 			check.errorf(x, InvalidComplex, invalidOp+"%v (mismatched types %s and %s)", call, x.typ, y.typ)
		builtins.go#L344: 			check.errorf(x, InvalidComplex, invalidArg+"arguments have type %s, expected floating-point", x.typ)
		builtins.go#L356: 			check.recordBuiltinType(call.Fun, makeSig(resTyp, x.typ, x.typ))
		builtins.go#L359: 		x.typ = resTyp
		builtins.go#L363: 		dst, _ := coreType(x.typ).(*Slice)
		builtins.go#L366: 		src0 := coreString(y.typ)
		builtins.go#L383: 			check.recordBuiltinType(call.Fun, makeSig(Typ[Int], x.typ, y.typ))
		builtins.go#L386: 		x.typ = Typ[Int]
		builtins.go#L392: 		map_ := x.typ
		builtins.go#L426: 		if isUntyped(x.typ) {
		builtins.go#L430: 				if isNumeric(x.typ) {
		builtins.go#L431: 					x.typ = Typ[UntypedComplex]
		builtins.go#L468: 			check.errorf(x, code, invalidArg+"argument has type %s, expected complex type", x.typ)
		builtins.go#L484: 			check.recordBuiltinType(call.Fun, makeSig(resTyp, x.typ))
		builtins.go#L487: 		x.typ = resTyp
		builtins.go#L531: 		x.typ = T
		builtins.go#L533: 			check.recordBuiltinType(call.Fun, makeSig(x.typ, types...))
		builtins.go#L551: 			if !allOrdered(a.typ) {
		builtins.go#L563: 				if !Identical(x.typ, a.typ) {
		builtins.go#L564: 					check.errorf(a, MismatchedTypes, invalidArg+"mismatched types %s (previous argument) and %s (type of %s)", x.typ, a.typ, a.expr)
		builtins.go#L590: 			check.updateExprType(a.expr, x.typ, true)
		builtins.go#L596: 				types[i] = x.typ
		builtins.go#L598: 			check.recordBuiltinType(call.Fun, makeSig(x.typ, types...))
		builtins.go#L610: 		x.typ = &Pointer{base: T}
		builtins.go#L612: 			check.recordBuiltinType(call.Fun, makeSig(x.typ, T))
		builtins.go#L651: 				params[i] = a.typ
		builtins.go#L663: 		x.typ = &emptyInterface
		builtins.go#L665: 			check.recordBuiltinType(call.Fun, makeSig(x.typ))
		builtins.go#L683: 		x.typ = Typ[UnsafePointer]
		builtins.go#L685: 			check.recordBuiltinType(call.Fun, makeSig(x.typ, x.typ, y.typ))
		builtins.go#L695: 		if hasVarSize(x.typ, nil) {
		builtins.go#L698: 				check.recordBuiltinType(call.Fun, makeSig(Typ[Uintptr], x.typ))
		builtins.go#L702: 			x.val = constant.MakeInt64(check.conf.alignof(x.typ))
		builtins.go#L705: 		x.typ = Typ[Uintptr]
		builtins.go#L723: 		base := derefStructPtr(x.typ)
		builtins.go#L774: 		x.typ = Typ[Uintptr]
		builtins.go#L783: 		if hasVarSize(x.typ, nil) {
		builtins.go#L786: 				check.recordBuiltinType(call.Fun, makeSig(Typ[Uintptr], x.typ))
		builtins.go#L789: 			size := check.conf.sizeof(x.typ)
		builtins.go#L798: 		x.typ = Typ[Uintptr]
		builtins.go#L804: 		ptr, _ := coreType(x.typ).(*Pointer)
		builtins.go#L816: 		x.typ = NewSlice(ptr.base)
		builtins.go#L818: 			check.recordBuiltinType(call.Fun, makeSig(x.typ, ptr, y.typ))
		builtins.go#L825: 		slice, _ := coreType(x.typ).(*Slice)
		builtins.go#L832: 		x.typ = NewPointer(slice.elem)
		builtins.go#L834: 			check.recordBuiltinType(call.Fun, makeSig(x.typ, slice))
		builtins.go#L852: 		x.typ = Typ[String]
		builtins.go#L854: 			check.recordBuiltinType(call.Fun, makeSig(x.typ, NewPointer(universeByte), y.typ))
		builtins.go#L867: 		x.typ = NewPointer(universeByte)
		builtins.go#L869: 			check.recordBuiltinType(call.Fun, makeSig(x.typ, Typ[String]))
		builtins.go#L876: 		if x.mode != constant_ || !isBoolean(x.typ) {
		builtins.go#L966: 	if tp, _ := Unalias(x.typ).(*TypeParam); tp != nil {
		builtins.go#L1010: 	return f(x.typ)
		call.go#L63: 	sig := x.typ.(*Signature)
		call.go#L105: 			args = []*operand{{mode: value, expr: expr, typ: T.sig}}
		call.go#L128: 	x.typ = sig
		call.go#L203: 		T := x.typ
		call.go#L249: 	sig, _ := coreType(x.typ).(*Signature)
		call.go#L318: 		x.typ = sig.results.vars[0].typ // unpack tuple
		call.go#L321: 		x.typ = sig.results
		call.go#L328: 	if x.mode == value && sig.TypeParams().Len() > 0 && isParameterized(sig.TypeParams().list(), x.typ) {
		call.go#L369: 						assert(n < x.typ.(*Signature).TypeParams().Len())
		call.go#L407: 			if t, ok := x.typ.(*Tuple); ok && x.mode != invalid {
		call.go#L411: 					resList[i] = &operand{mode: value, expr: e, typ: v.typ}
		call.go#L573: 			if asig, _ := arg.typ.(*Signature); asig != nil && asig.TypeParams().Len() > 0 {
		call.go#L588: 				arg.typ = asig                          // new type identity for the function argument
		call.go#L643: 			asig := arg.typ.(*Signature)
		call.go#L646: 			arg.typ = check.instantiateSignature(call.Pos(), arg.expr, asig, targs[j:k], nil) // TODO(gri) provide xlist if possible (partial instantiations)
		call.go#L742: 				x.typ = exp.typ
		call.go#L746: 				x.typ = exp.typ
		call.go#L749: 				x.typ = exp.typ
		call.go#L751: 					x.typ = x.typ.(*Pointer).base
		call.go#L755: 				x.typ = exp.typ
		call.go#L758: 					x.typ = x.typ.(*Signature).results.vars[0].typ
		call.go#L762: 				x.typ = exp.typ
		call.go#L777: 		if def != nil && def.typ == x.typ {
		call.go#L808: 	obj, index, indirect = lookupFieldOrMethod(x.typ, x.mode == variable, check.pkg, sel, false)
		call.go#L811: 		if !isValid(under(x.typ)) {
		call.go#L823: 				check.errorf(e.Sel, InvalidMethodExpr, "invalid method expression %s.%s (needs pointer receiver (*%s).%s)", x.typ, sel, x.typ, sel)
		call.go#L825: 				check.errorf(e.Sel, InvalidMethodExpr, "cannot call pointer method %s on %s", sel, x.typ)
		call.go#L831: 		if isInterfacePtr(x.typ) {
		call.go#L832: 			why = check.interfacePtrError(x.typ)
		call.go#L834: 			alt, _, _ := lookupFieldOrMethod(x.typ, x.mode == variable, check.pkg, sel, true)
		call.go#L835: 			why = check.lookupError(x.typ, sel, alt, false)
		call.go#L850: 			check.errorf(e.Sel, MissingFieldOrMethod, "%s.%s undefined (type %s has no method %s)", x.expr, sel, x.typ, sel)
		call.go#L854: 		check.recordSelection(e, MethodExpr, x.typ, m, index, indirect)
		call.go#L882: 		params = append([]*Var{NewVar(sig.recv.pos, sig.recv.pkg, name, x.typ)}, params...)
		call.go#L884: 		x.typ = &Signature{
		call.go#L897: 			check.recordSelection(e, FieldVal, x.typ, obj, index, indirect)
		call.go#L903: 			x.typ = obj.typ
		call.go#L908: 			check.recordSelection(e, MethodVal, x.typ, obj, index, indirect)
		call.go#L923: 				typ := x.typ
		call.go#L960: 			x.typ = &sig
		const.go#L37: 	if isTyped(x.typ) {
		const.go#L38: 		check.representable(x, under(x.typ).(*Basic))
		const.go#L258: 		if isNumeric(x.typ) && isNumeric(typ) {
		const.go#L266: 			if !isInteger(x.typ) && isInteger(typ) {
		const.go#L304: 	if newType != x.typ {
		const.go#L305: 		x.typ = newType
		conversions.go#L29: 		case isInteger(x.typ) && isString(t):
		conversions.go#L51: 		if !ok && isInteger(x.typ) && isInteger(T) {
		conversions.go#L68: 			if isString(x.typ) && isBytesOrRunes(u) {
		conversions.go#L72: 				if isInteger(x.typ) && isInteger(u) {
		conversions.go#L102: 	if isUntyped(x.typ) {
		conversions.go#L112: 		if isTypes2 && x.typ == Typ[UntypedNil] {
		conversions.go#L115: 			final = Default(x.typ) // default type of untyped nil is untyped nil
		conversions.go#L116: 		} else if x.mode == constant_ && isInteger(x.typ) && allString(T) {
		conversions.go#L117: 			final = x.typ
		conversions.go#L122: 	x.typ = T
		conversions.go#L146: 	V := Unalias(x.typ)
		conversions.go#L256: 			x.typ = V.typ
		conversions.go#L274: 			x.typ = V.typ
		conversions.go#L287: 				errorf("cannot convert %s to type %s (in %s)", x.typ, T.typ, Tp)
		expr.go#L75: 		if !pred(x.typ) {
		expr.go#L146: 		x.typ = &Pointer{base: x.typ}
		expr.go#L150: 		u := coreType(x.typ)
		expr.go#L169: 		x.typ = ch.elem
		expr.go#L175: 		if !allInteger(x.typ) {
		expr.go#L195: 		if isUnsigned(x.typ) {
		expr.go#L196: 			prec = uint(check.conf.sizeof(x.typ) * 8)
		expr.go#L358: 	if x.mode == invalid || isTyped(x.typ) || !isValid(target) {
		expr.go#L359: 		return x.typ, nil, 0
		expr.go#L365: 		if m := maxType(x.typ, target); m != nil {
		expr.go#L384: 		switch x.typ.(*Basic).kind {
		expr.go#L438: 		return Default(x.typ), nil, 0
		expr.go#L454: 	if !isValid(x.typ) || !isValid(y.typ) {
		expr.go#L469: 	ok, _ := x.assignableTo(check, y.typ, nil)
		expr.go#L471: 		ok, _ = y.assignableTo(check, x.typ, nil)
		expr.go#L478: 		cause = check.sprintf("mismatched types %s and %s", x.typ, y.typ)
		expr.go#L490: 			typ := x.typ
		expr.go#L492: 				typ = y.typ
		expr.go#L503: 		case !Comparable(x.typ):
		expr.go#L505: 			cause = check.incomparableCause(x.typ)
		expr.go#L508: 		case !Comparable(y.typ):
		expr.go#L510: 			cause = check.incomparableCause(y.typ)
		expr.go#L517: 		case !allOrdered(x.typ):
		expr.go#L520: 		case !allOrdered(y.typ):
		expr.go#L540: 		check.updateExprType(x.expr, Default(x.typ), true)
		expr.go#L541: 		check.updateExprType(y.expr, Default(y.typ), true)
		expr.go#L546: 	x.typ = Typ[UntypedBool]
		expr.go#L552: 		if isTypeParam(x.typ) || isTypeParam(y.typ) {
		expr.go#L554: 			if !isTypeParam(x.typ) {
		expr.go#L557: 			cause = check.sprintf("type parameter %s cannot use operator %s", errOp.typ, op)
		expr.go#L560: 			what := compositeKind(errOp.typ)
		expr.go#L562: 				what = check.sprintf("%s", errOp.typ)
		expr.go#L599: 	if allInteger(x.typ) || isUntyped(x.typ) && xval != nil && xval.Kind() == constant.Int {
		expr.go#L624: 		if isUntyped(y.typ) {
		expr.go#L636: 		case allInteger(y.typ):
		expr.go#L637: 			if !allUnsigned(y.typ) && !check.verifyVersionf(y, go1_13, invalidOp+"signed shift count %s", y) {
		expr.go#L641: 		case isUntyped(y.typ):
		expr.go#L662: 				if !isInteger(x.typ) {
		expr.go#L663: 					x.typ = Typ[UntypedInt]
		expr.go#L679: 			if !isInteger(x.typ) {
		expr.go#L680: 				x.typ = Typ[UntypedInt]
		expr.go#L690: 		if isUntyped(x.typ) {
		expr.go#L721: 	if !allInteger(x.typ) {
		expr.go#L783: 	if !Identical(x.typ, y.typ) {
		expr.go#L786: 		if isValid(x.typ) && isValid(y.typ) {
		expr.go#L792: 				check.errorf(posn, MismatchedTypes, invalidOp+"%s (mismatched types %s and %s)", e, x.typ, y.typ)
		expr.go#L794: 				check.errorf(posn, MismatchedTypes, invalidOp+"%s %s= %s (mismatched types %s and %s)", lhs, op, rhs, x.typ, y.typ)
		expr.go#L808: 		if (x.mode == constant_ || allInteger(x.typ)) && y.mode == constant_ && constant.Sign(y.val) == 0 {
		expr.go#L815: 		if x.mode == constant_ && y.mode == constant_ && isComplex(x.typ) {
		expr.go#L834: 		if op == token.QUO && isInteger(x.typ) {
		expr.go#L861: 		if isTyped(x.typ) && isTyped(y.typ) {
		expr.go#L868: 		if isNonTypeParamInterface(x.typ) || isNonTypeParamInterface(y.typ) {
		expr.go#L872: 		if allBoolean(x.typ) != allBoolean(y.typ) {
		expr.go#L876: 		if allString(x.typ) != allString(y.typ) {
		expr.go#L881: 			return hasNil(y.typ)
		expr.go#L884: 			return hasNil(x.typ)
		expr.go#L888: 		if isPointer(x.typ) || isPointer(y.typ) {
		expr.go#L895: 		check.convertUntyped(x, y.typ)
		expr.go#L899: 		check.convertUntyped(y, x.typ)
		expr.go#L971: 	switch t := x.typ.(type) {
		expr.go#L988: 		x.typ = Typ[Invalid]
		expr.go#L999: 	x.typ = Typ[Invalid]
		expr.go#L1071: 		if isTypeParam(x.typ) {
		expr.go#L1075: 		if _, ok := under(x.typ).(*Interface); !ok {
		expr.go#L1085: 		x.typ = T
		expr.go#L1096: 			check.validVarType(e.X, x.typ)
		expr.go#L1097: 			x.typ = &Pointer{base: x.typ}
		expr.go#L1100: 			if !underIs(x.typ, func(u Type) bool {
		expr.go#L1116: 			x.typ = base
		expr.go#L1143: 		x.typ = check.typ(e)
		expr.go#L1209: 	if check.assertableTo(x.typ, T, &cause) {
		expr.go#L1218: 	check.errorf(e, ImpossibleAssert, "impossible type assertion: %s\n\t%s does not implement %s %s", e, T, x.typ, cause)
		expr.go#L1249: 	if t, ok := x.typ.(*Tuple); ok && x.mode != invalid {
		expr.go#L1253: 			list[i] = &operand{mode: value, expr: e, typ: v.typ}
		expr.go#L1261: 		x2 := &operand{mode: value, expr: e, typ: Typ[UntypedBool]}
		expr.go#L1263: 			x2.typ = universeError
		expr.go#L1324: 		if t, ok := x.typ.(*Tuple); ok {
		index.go#L32: 		x.typ = check.varType(e.orig)
		index.go#L33: 		if isValid(x.typ) {
		index.go#L39: 		if sig, _ := under(x.typ).(*Signature); sig != nil && sig.TypeParams().Len() > 0 {
		index.go#L54: 	switch typ := under(x.typ).(type) {
		index.go#L65: 			x.typ = universeByte // use 'byte' name
		index.go#L74: 		x.typ = typ.elem
		index.go#L81: 			x.typ = typ.elem
		index.go#L87: 		x.typ = typ.elem
		index.go#L100: 		x.typ = typ.elem
		index.go#L105: 		if !isTypeParam(x.typ) {
		index.go#L112: 		if underIs(x.typ, func(u Type) bool {
		index.go#L174: 				x.typ = elem
		index.go#L182: 			x.typ = elem
		index.go#L203: 	if x.typ == nil {
		index.go#L204: 		x.typ = Typ[Invalid]
		index.go#L220: 	switch u := coreString(x.typ).(type) {
		index.go#L222: 		check.errorf(x, NonSliceableOperand, invalidOp+"cannot slice %s: %s has no core type", x, x.typ)
		index.go#L243: 			if isUntyped(x.typ) {
		index.go#L244: 				x.typ = Typ[String]
		index.go#L256: 		x.typ = &Slice{elem: u.elem}
		index.go#L262: 			x.typ = &Slice{elem: u.elem}
		index.go#L360: 		return x.typ, -1
		index.go#L375: 	return x.typ, v
		index.go#L390: 	if !allInteger(x.typ) {
		infer.go#L176: 		if isParameterized(tparams, par.typ) || isParameterized(tparams, arg.typ) {
		infer.go#L179: 			if isTyped(arg.typ) {
		infer.go#L180: 				if !u.unify(par.typ, arg.typ, assign) {
		infer.go#L181: 					errorf(par.typ, arg.typ, arg)
		infer.go#L343: 				max = arg.typ
		infer.go#L345: 				m := maxType(max, arg.typ)
		infer.go#L347: 					err.addf(arg, "mismatched types %s and %s (cannot infer %s)", max, arg.typ, tpar)
		literals.go#L104: 		x.typ = sig
		literals.go#L298: 						if Identical(vtyp, x.typ) {
		literals.go#L303: 					visited[xkey] = append(visited[xkey], x.typ)
		literals.go#L346: 	x.typ = typ
		operand.go#L62: 	typ  Type
		operand.go#L117: 			switch x.typ {
		operand.go#L123: 				return fmt.Sprintf("nil (of type %s)", TypeString(x.typ, qf))
		operand.go#L127: 		if x.mode == value && x.typ == Typ[UntypedNil] {
		operand.go#L142: 			expr = TypeString(x.typ, qf)
		operand.go#L161: 		if x.typ != nil {
		operand.go#L162: 			if isUntyped(x.typ) {
		operand.go#L163: 				buf.WriteString(x.typ.(*Basic).name)
		operand.go#L184: 		if isValid(x.typ) {
		operand.go#L186: 			if isGeneric(x.typ) {
		operand.go#L194: 			tpar, _ := Unalias(x.typ).(*TypeParam)
		operand.go#L196: 				switch x.typ.(type) {
		operand.go#L198: 					what := compositeKind(x.typ)
		operand.go#L201: 						what = under(x.typ).(*Basic).name
		operand.go#L209: 			WriteType(&buf, x.typ, qf)
		operand.go#L289: 		x.typ = Typ[Invalid]
		operand.go#L293: 	x.typ = Typ[kind]
		operand.go#L302: 		return x.mode == value && x.typ == Typ[UntypedNil]
		operand.go#L318: 	V := Unalias(x.typ)
		operand.go#L423: 				errorf("cannot assign %s to %s (in %s)", x.typ, T.typ, Tp)
		operand.go#L442: 			x.typ = V.typ
		recording.go#L29: 		typ = x.typ
		recording.go#L32: 		typ = x.typ
		recording.go#L103: 	t0, t1 := a[0].typ, a[1].typ
		stmt.go#L243: 		check.convertUntyped(&v, x.typ)
		stmt.go#L261: 				if Identical(v.typ, vt.typ) {
		stmt.go#L269: 			seen[val] = append(seen[val], valueType{v.Pos(), v.typ})
		stmt.go#L347: 			T = x.typ
		stmt.go#L400: 			T = x.typ
		stmt.go#L469: 		u := coreType(ch.typ)
		stmt.go#L502: 		if !allNumeric(x.typ) {
		stmt.go#L503: 			check.errorf(s.X, NonNumericIncDec, invalidOp+"%s%s (non-numeric type %s)", s.X, s.Tok, x.typ)
		stmt.go#L622: 		if x.mode != invalid && !allBoolean(x.typ) {
		stmt.go#L649: 			if x.mode != invalid && !Comparable(x.typ) && !hasNil(x.typ) {
		stmt.go#L650: 				check.errorf(&x, InvalidExprSwitch, "cannot switch on %s (%s is not comparable)", &x, x.typ)
		stmt.go#L657: 			x.typ = Typ[Bool]
		stmt.go#L742: 				if isTypeParam(x.typ) {
		stmt.go#L744: 				} else if IsInterface(x.typ) {
		stmt.go#L850: 			if x.mode != invalid && !allBoolean(x.typ) {
		stmt.go#L896: 		k, v, cause, ok := rangeKeyVal(x.typ, func(v goVersion) bool {
		stmt.go#L926: 	rangeOverInt := isInteger(x.typ)
		stmt.go#L969: 				y.typ = typ
		stmt.go#L1003: 				if x.mode != invalid && !isInteger(x.typ) {
		stmt.go#L1004: 					check.softErrorf(lhs, InvalidRangeExpr, "cannot use iteration variable of type %s", x.typ)
		stmt.go#L1010: 				y.typ = typ
		typexpr.go#L145: 	x.typ = typ
		typexpr.go#L262: 			typ := x.typ
		typexpr.go#L279: 			typ := x.typ
		typexpr.go#L534: 	if isUntyped(x.typ) || isInteger(x.typ) {
		typexpr.go#L545: 	if isInteger(x.typ) {